package com.mtiiot.fsmanage.controller;

import com.mtiiot.fsmanage.server.SmServer;
import org.codehaus.jackson.map.ObjectMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Created by Administrator on 16-8-17.
 */

@Controller
public class SmController {

    @Autowired
    SmServer smServer;

    /**
     * 查询短信数据
     *
     */
    @RequestMapping(value="/sm/smQuery.action",produces="application/json;charset=UTF-8")
    @ResponseBody
    public Object smQuery(String sysName,String l1Name,String l2Name,String l3Name,String times,String queryKeyWord,int count,String sort)throws Exception{
        Object obj=smServer.smQuery(sysName, l1Name, l2Name, l3Name, times, queryKeyWord, count, sort);
        ObjectMapper mapper = new ObjectMapper();
        String jsonStr=mapper.writeValueAsString(obj);
        return jsonStr;
    }

    /**
     * 查询短信数据
     */
    @RequestMapping(value="/sm/smStatistics.action",produces="application/json;charset=UTF-8")
    @ResponseBody
    public Object smStatistics(String sysName,String l1Name,String l2Name,String l3Name,String times) throws Exception {
        Object obj=smServer.smStatistics(sysName, l1Name, l2Name, l3Name, times);
        ObjectMapper mapper = new ObjectMapper();
        String jsonStr=mapper.writeValueAsString(obj);
        System.out.println(jsonStr);
        return jsonStr;
    }
}
